<?php
namespace Hive\Ressource;
/**
 * Contact Group Object.
 *
 * It represant a regroupement of contact. Each contact can be associate to
 * a certain group to handle authorizations.
 *
 * @author Xavier VILAIN
 * @package Hive\Ressource
 *
 * @property string	$grouping	Group Id
 * @property string	$name		Group Name
 */
class Note extends \Fox\Object {

	/**
	 * Link To Ressource
	 * @var string
	 */
	const LINK_RESSOURCE = 'ressource';

	/**
	 * 
	 * Default Type Note
	 * @var int
	 */
	const TYPE_DEFAULT = 1;
	
	/**
	 * (non-PHPdoc)
	 * @see includes/classes/Fox/Object/Versioned::afterVersionCreate()
	 */
	protected function afterCreate()
	{
		// Add to the search engine
		$searchEngine = new \Fox\SearchEngine();
		$searchEngine->add($this,$this->ressource_id,\Hive\Ressource::className());
	}
	
	/**
	 * (non-PHPdoc)
	 * @see includes/classes/Fox/Object/Versioned::afterVersionUpdate()
	 */
	protected function afterUpdate()
	{
		// Add to the search engine
		$searchEngine = new \Fox\SearchEngine();
		$searchEngine->synchronize($this,$this->ressource_id,\Hive\Ressource::classname());
	}
	
	/**
	 * (non-PHPdoc)
	 * @see Fox.Object::delete()
	 */
	public function delete() {
		parent::delete();
		$searchEngine = new \Fox\SearchEngine();
		$searchEngine->delete($this,$this->ressource_id,Ressource::classname());
	}
}
\Fox\Dao::infos(Note::className(),new \Fox\Object\Info('ressource_notes', \Fox\Databases::DB_APP));